# 6_4 屏幕使用：显示图片
# https://learn.adafruit.com/circuitpython-display-support-using-displayio
# https://learn.adafruit.com/circuitpython-display-support-using-displayio/ui-quickstart
# https://learn.adafruit.com/custom-fonts-for-pyportal-circuitpython-display

'''
4. 显示图片
'''
import board
import displayio
import adafruit_imageload

# 1. 屏幕基础配置
display = board.DISPLAY

# 4. 显示图片
bitmap, palette = adafruit_imageload.load(
    "images/adafruit_products_Adafruit_ESP32-S3_TFT_Feather_Pinout.bmp",
    # "images/bmp_image_for_cirpy.bmp",
    bitmap=displayio.Bitmap,
    palette=displayio.Palette)

tile_grid = displayio.TileGrid(bitmap, pixel_shader=palette, x=0 ,y=0, width=1, height=1, tile_width=bitmap.width, tile_height=bitmap.height, default_tile = 0)
image_group = displayio.Group()
image_group.append(tile_grid)
display.show(image_group)
